Skip to content

email_manager - render email body in sandboxed iframe#1521

Merged
TheMadBug merged 1 commit intomasterfrom
email-manager-security
Apr 16, 2026
Merged

email_manager - render email body in sandboxed iframe#1521
TheMadBug merged 1 commit intomasterfrom
email-manager-security

Conversation

@davmlaw
Copy link
Copy Markdown
Contributor

@davmlaw davmlaw commented Apr 2, 2026

Summary

Render email body HTML inside a sandboxed <iframe srcdoc="..."> in both email_pure.html and email_detail.html, rather than injecting it directly into the page DOM via | safe.

This prevents any script content in stored email bodies from executing in the viewer's browser.

Relates to SACGF/variantgrid_private#3828.

Test plan

  • Open a logged email via the email_manager detail view — body renders correctly inside the iframe
  • Open /email_manager/pure/<id> — body renders correctly in the standalone window
  • Confirm that email styling (inline CSS) is preserved inside the iframe

Prevents stored XSS by rendering email HTML content inside a sandboxed
iframe (srcdoc) rather than injecting it directly into the page DOM.
@TheMadBug
Copy link
Copy Markdown
Member

Tested and confirm it works. Very low threat as we are the ones generating the HTML that is to be displayed, but little downside to it.

@TheMadBug TheMadBug merged commit 0a365aa into master Apr 16, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants